package com.atguigu.study.base.SaleTick;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @Author 快点干早点散
 * @Create 2025/4/22 20:26
 * Description:
 */
public class ReentrantLockDemo {
 public  synchronized void a(){
     this.b();
     System.out.println("a");
 }
 public  synchronized void b(){
     this.c();
     System.out.println("b");
 }

 private  final ReentrantLock lock=new ReentrantLock();
 public void c(){
     lock.lock();
     try {
         d();
         System.out.println("c");
     } finally {

         lock.unlock();


     }
 }
 public  void  d(){
     lock.lock();
     try {

         System.out.println("d");
         } finally {

         lock.unlock();

     }
 }
    public static void main(String[] args) {
       new ReentrantLockDemo().a();
    }
}
